#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QCursor>
#include <QListWidget>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QPixmap>
#include <QPoint>
#include <QColor>
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QMouseEvent>

#include "tabs.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void paintEvent(QPaintEvent*);
    //监听鼠标事件
    void mousePressEvent(QMouseEvent*);
    void mouseMoveEvent(QMouseEvent*);
    void mouseReleaseEvent(QMouseEvent*);

    struct single_line{     //单条线条
        QVector<QPoint> trail;//轨迹
        int width;//粗细
        int type;//线条类型
    };
    struct single_text{     //单条文本
        QString content;//文本内容
        QPoint location;//坐标位置
    };

    QVector<single_line> lines;     //线条集合
    QVector<QRect> rects;           //矩形集合
    QVector<QRect> ellipses;        //椭圆集合
    QVector<QRect> straights;       //直线集合
    QVector<single_text> texts;     //文本集合
    QVector<int> opts;                      //操作类型集合
    QVector<QColor> opt_colors;             //操作颜色合集

signals:

private slots:
    void on_listWidget_tab_currentRowChanged(int currentRow);//槽函数------------>改变当前画布
    void deleteCanva(int canva_index);//槽函数------------>删除画布

    //菜单栏槽函数
    void on_action_new_triggered();
    void on_action_open_triggered();
    void on_action_save_triggered();
    void on_action_saveAs_triggered();
    //工具栏槽函数
    void on_toolButton_pencil_clicked();
    void on_toolButton_fillup_clicked();
    void on_toolButton_text_clicked();
    void on_toolButton_eraser_clicked();
    void on_toolButton_selector_clicked();
    void on_toolButton_magnifier_clicked();
    void on_toolButton_magnifier_boost_clicked();
    void on_toolButton_magnifier_shrink_clicked();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
